package com.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

@Service
public class MessageHandler {

    @Autowired
    private SimpMessagingTemplate messagingTemplate;

    public void handleMessage(String recipient, String message) {
        messagingTemplate.convertAndSendToUser(recipient, "/queue/myQueue", message);
    }
}
